Fractgen V1.00 -------------- FRACTGEN is a fractal generator for the Atari ST/TT/Falcon range of computers. It is designed to take account of the power of the Atari range and utilise extra hardware if available. For instance, the classic Mandelbrot image can be generated in less than 25 seconds in ST Low rez on a standard ST when using Fractgen. Virtually any screen resolution can be catered for and full use will be made of 68881/2 maths coprocessors and 68020/030/040 processors if present. This version of Fractgen is intended as a pre-release of version 2.0, which I am already developing. Fractgen V2.0 is intended to be a modular system, allowing programmers to takee advantage of the speed and functionality of Fractgen and allowing users to add new fractals generators to their collection simply be adding new modules. I also intend to add true-colour and windows support, and perhaps a hint of raytracing. With V2.0, I am hoping to create a similar philosophy to FractINT on the PC ranges, where dozens of programmers have contributed to make FractINT one of the best fractal generators on any machine. Can we ST enthusiasts beat their efforts? Hopefully, Fractint V2.0 should appear by late-1993. Fractgen was designed and programmed by; Jon Marshall 28 Holbrook Road Stratford London E15 3EA With thanks to Steven Elkins for much testing and gloating over how good Fractgen looks in TT low rez. This program is considered FREEWARE: that is that the program may freely copied provided that; 1) No fee is charged for the copy, apart from the normal duplication costs incurred by PD libraries. 2) The program, and this documentation, are copied together and unaltered. ****************** ** Introduction ** ****************** For those of you who don't know what most fractal generators are they can usually be summed up in a single phrase, "Beautiful, and usually psychedelic, computer generated pictures". They are generated by repeating generally simple equations involving complex numbers many times, something which a computer can do quite rapidly. You do not need to know the maths behind fractal images to generate enjoy the beauty behind the images. For this reason, and because there are plenty of books on fractals, complex dynamics and chaos theory around, I shall not go into the maths here. More complex fractal algorithms allow the realistic generation of mountains, waves, trees, landscapes and other objects found generally in nature. These techniques are not present in this version of Fractgen, but I hope to add some to version 2.0. Certain types of fractals are generated using similar algorithms but with slightly different mathematical equations. It makes sense under these conditions to make a single fractal generator, with such features as Save options, and allow the user to select which fractal he or she wishes to see. This is why Fractgen was designed, and currently has 6 Mandelbrot/Julia type fractals built-in. ********************* ** Fractgen in use ** ********************* Fractgen takes over the entire screen and is operated via a system of popup menus and dialog boxes. The program will always be generating an image unless it has finished or is waiting for user input. Upon loading it will immediately start drawing the classic Mandelbrot image. Whilst an image is being generated the left mouse button can be to 'magnify' an area of the screen (zoom in), and the right mouse button is used to call up the main menu. You may have to wait a second or more for a mouse click to be acted upon. In magnify mode you can select an area of the screen to zoom into. Note that you do not have to wait for the screen to finish generating before zooming in - this can be done at any time. Use the mouse and hold the left mouse button down to select an area to magnify to full screen size. Fractgen will then start drawing the image in detail. If you hold the right mouse button down before selecting an area to magnify, or when you release the left mouse button after selecting an area then the magnify option will be cancelled. Remember that fractals are infinite - no matter how far you zoom in you will still be able to see plenty of detail. The best areas to zoom in upon are those where plenty of colours meet, places of uniform colour will generally show no further detail when magnified. When the main menu has been requested it will be displayed at roughly the current mouse position over the fractal image being drawn. You can then either select an option or cancel the menu by clicking the left mouse button off the menu area, i.e. over the fractal image. You may like to take a look at the two "tutorial" sections in this document, "Jon's Guide to Getting Started", and "Jon's Guide to Wacky Fracs". Main Menu Options ================= Home: This will zoom out the current image as far as it can go. Back up: This will take you to the previous image being generated, i.e. the image that was being generated before the last zoom, which will have been saved if memory permits. Save: Save the current fractal image. See later for file formats. Colours: Change the colour palette values. See later for more details. Fractal: Choose a different fractal. See later Options: The options range from changing the current fractal being drawn by entering new coordinates, to drawing options such as coloured decomposition. See later for a full explanation. Maths mode: See later. Draw mode: See later. Fractal Choosing ================ There are six different types of fractal in this version of Fractgen, and they can be selected from "Choose Fractal" dialog box. The current fractal will be highlighted, and information on that fractal is displayed at the bottom of the dialog box. Double-clicking on a name will select that fractal. Alternatively the "Select" button can be used. Both of the "Julia" sets require parameters to be entered before they can be drawn, or the parameters can be selected with the mouse from a connected Mandelbrot set. If you are drawing the classic Mandelbrot, or Mandelbrot Lambda - then pressing the SPACE bar will bring up a set of cross-hairs. The coordinates of a point selected by the mouse will then be passed as parameters to the corresponding Julia sets. To return to the Mandelbrot set, press SPACE again - your old Mandelbrot screen will have been saved if memory permitted. Colour choosing =============== The colours that you view the fractal in can be changed in this dialog box. On the left of the dialog box is a grid showing up to 16 colours as adjacent squares. On screens which can display more than 16 colours this grid can be scrolled. Selecting a square will display that colour's red, green and blue (RGB) components in the 3 scroll bars to the right of the dialog box. The components are displayed as values between 0 and 1000, as is required by GEM. Note that most screens cannot display such a large number of colours. The "Snap" pop-up button at the bottom of the dialog box will cause the RGB sliders to be limited to the component values that can be displayed by your computer - usually 8 on and ST and 16 on a STE/TT, given a total of 512 and 4096 colours respectively. When "Snap" is on the up and down arrows will move the sliders by the smallest amount that can be handled by your computer. When snap is off the sliders will move 1 unit when selecting the arrows, and 20 units when clicking on the sliders. The "View" button will remove the dialog box from the screen whilst the left mouse button is held down, allowing you to see how a change in palette will affect the fractal being drawn. Colours can be automatically shaded between two boundaries. For example, if you set colour 0 as black (0, 0, 0) and colour 7 as red (1000, 1000, 1000) then selecting colour 0 followed by double clicking on colour 7 would shade colours 1 to 6 in increasing shades of red. By default, Fractgen uses colours 1 to 15 (in 16 colour modes) to draw the current fractal and colour 0 to represent any portions of the picture that could not be computed - though these settings can be changed in the "Options" menu. In two colour modes, such as ST High rez, then colour 0 is used both to draw the image and the areas which could not be computed. Note 1: If the "Snap" option is off and you are using ST High rez then the values shown as the RGB components may not be what you see on the screen. Note 2: I am sorry but there is no way to save or load colour palettes on this version of Fractgen - I hope to remove this restriction by the next version of Fractgen. Note 3: I would have loved to have added colour cycling to this version of Fractgen but there seems to be no *legal* way of doing this using GEM whilst allowing a fractal to continue generating. Options ======= At the bottom of the Options dialog box is a scroll bar allowing you to select up to 3 pages of different options. Selecting "Redraw" will redraw the image with the changed options, pasting the new image over the top of the old image. "Clear" does the same as redraw but clears the screen before redrawing the image. "Cancel" will leave the options unchanged. Page 1 ------ The coordinates of the current image within the fractal are displayed at the top and can be altered by hand (as opposed to zooming). The parameters required by the fractal, if any, are displayed in the centre. The current fractal being drawn and the total amount of time spent drawing this image are displayed at the bottom of the screen, along with whether the image has finished being drawn or is still being computed. Page 2 ------ How a fractal is displayed depends not only on the mathematical equation being used to compute the fractal but the interpretation given to the results of the equation. Usually, after an equation has been run for a pixel the fractal generator is given two results: the value of a final complex the number of times the equation was repeated. If the complex number exceeds a certain size then we say that is has escaped to infinity and we *usually* colour the pixel on the number of times the equation was executed before the complex number escaped to infinity. If it did not reach infinity then we *usually* colour the pixel black. Page 2 deals with how to define infinity, the maximum number of times an equation can be run before we say that the complex number will never reach infinity and how to colour the pixel if the number does reach infinity. The "colour" pop-up defines how to colour the pixel. The "Standard" option is to colour the pixel on the number of times the equation was executed. The "Binary decomposition" will display the pixel in one of two colours depending on final value of the complex number, the "Coloured decomposition" will colour the pixel in a variety of colours depending on the final value. The colours to be used can be entered in the "Colours xxxx to yyyy" area. The default is "1 to 15" in 16 colour modes, but this can be changed. I.e. changing to "15 to 1" will reverse the colour order, "1 to 8" will use only half of the palette, etc. If using binary decomposition then the colour are should read "Colours xxxx and yyyy", as only 2 colours are used. The "Max iterations" defines the maximum number of iterations performed on the equation. "Min iterations" defines the effective minimum. Increasing the maximum number of iterations will increase the detail of the picture at the expense of image generation time - the default is 128. The "Saturate" pop-ups confines the value returned for the number of iterations performed to within those set by the maximum and minimum sizes. For instance, if the number of iteration performed was 16 but the minimum number of iterations was 50, then we would pretend that the number of iterations performed was 50 if the minimum saturate option was on. The "Max Value" gives the maximum size that a number can reached before it is declared to be escaping to infinity, and is usually 4.0 . *** For those of you who have not understood a word of the above I shall *** refer you to the "Jon's Guide to ..." sections below to see some of *** these options in action. Page 3 ------ Page 3 deals with how to colour a pixel that does not escape to infinity. The default, in the "colour" pop-up is "standard", and just colours the pixel as the value below it, usually colour 0. The "Proportioned" option colours the pixel depending on how big it got when the maximum number of iterations was reached. It pays to keep the maximum number of iterations low when using this option. Complex numbers which do not escape to infinity generally tend toward one of a number of values, depending on the fractal. Thus we say that the number was "attracted" towards a value and this the third colouring option. The radius of a small disc around this attractor where we check for the value is given by the "Attractor disc radius" field, the maximum number of iterations performed by the attractor routine is given in "Max attractor iterations". The "Colours xxx to yyy" defines which part of the colour palette to use. For the "standard" option this should read "Colour xxx" as only 1 colour is used. When changing between standard and the other two options do not forget to change the colours to use else it is likely that you will see no difference in the picture. Saving ====== Fractgen allows the saving of the created images. Unfortunately, the image format used to save the images are only of much use to screens generated in ST low, medium or high rez. For the ST resolutions, the image is saved as a Degas Elite .PI? file. For other resolutions the image is saved in the same format with extra data corresponding to the extra size of the screen. The format is; Byte Meaning ==== ======= 0-1 Screen rez as returned by the OS 2-33 16 Colours in STE format 34-... Screen data Note that this is a temporary situation and a better and more versatile image format will be adopted for Fractgen V2.0 (probably .IMG or .IFF or both). Also saved is a .FRI information file which contains the coordinates of the saved screen along with general information for recreating the image. Again this system is being improved for V2.0. Maths & drawing modes ===================== Fractgen's relatively quick rendering speeds come from the utilisation of these two options, giving speed increases of up to 100 times better than fractal generators without similar facilities. The traditional way to generate a fractal image is to perform large numbers of calculations on every pixel on the screen using floating point mathematics. Fractgen will, by default, speed things quite considerably by using integer mathematics if no maths coprocessor is available and by generating as few a number of pixels as possible with no, or little, loss in image quality. There are 3 maths modes to choose from; 16-bit integer is the quickest and the most limited. Typically, using this mode image generation will be approximately 14 times quicker than when using floating point mathematics when no maths coprocessor is involved. However this mode can support very little image detail, and almost any zoom will show a loss of quality. Some fractals are unable to use this mode because of the limitations imposed. 32-bit integer is the next quickest at some 4 to 7 times quicker than software floating point on an ST, with an even larger increase on machine with a 68020 or better processor, and you have to zoom in quite a long way before the image quality suffers. The last option is floating point, and should be avoided unless you have a floating point coprocessor or you are zooming-in a very long way. The default is to use the floating point options if a 68881/68882 inline coprocessor or 68040 in installed, i.e. on a TT or the (currently) rumoured Falcon040, failing which the 32-bit integer mode is used unless the image can be reasonably made using 16-bit integers. On selecting the 'Maths mode' option from the main menu you are presented with a submenu allowing you to choose one of; 1) Use Quickest - Use the quickest mode for your machine. 2) 16-bit integer. 3) 32-bit integer. 4) Floating point. Drawing modes ============= ST-High rez is made up of 256,000 pixels. If several thousand calculations have to be made to a single pixel then you can see that quite a large amount of processing will be required for that image. It follows that image generation time depends very much on the number of pixels needed to be calculated. Fractgen provides 2 drawing modes capable of reducing the number of pixels needed to be calculated in order to draw a specific image. Both work on the principle of identifying areas an image which are made up of large amounts of the same colour. Trace mode: This identifies an area of colour by tracing around the perimeter of the area. Once the perimeter has been identified the algorithm assumes that everything inside that area will be the same colour. This is a pretty big assumption - it will fall down if the area has an 'island' of colour inside, but the mode works very well in all but a few cases. Guessing mode: This divides up the screen into squares and assumes that if the four corners of the square are the same colour then so are the insides. Again this is a big assumption, but works well since the chances of 4 pixels forming a square being the same colour when the internal pixels are not are slim, apart from a few awkward cases (such as when using binary decomposition - where you are advsied not to use the guessing mode). The two other modes provided both generate every pixel which makes up an image. The 'Single pass' mode will generate every pixel from top left to bottom right linearly, the 'Dual pass' mode will generate the image in 2x2 pixel blocks on the first pass and the rest of the image on the second - thus allowing the user to roughly see what the image is going to look like before all of it is generated. The default drawing mode is to use Guessing mode if the screen resolution is better than 480x300 pixels, else the trace mode will be used (since it is slightly quicker at lower resolutions) unless the fractal image is such that the trace mode is likely to not produce a quality image. The drawing mode options are selected from the 'Draw mode' sub-menu of the main menu. Note: If you think the image quality is not what it should be, i.e. perhaps there are some jagged lines where you would expect smooth curves, then I would advise you to change either the maths or the drawing modes. For optimum quality, use single or dual pass drawing modes with floating point mathematics. ************************************ ** Jon's Guide to Getting Started ** ************************************ Fractals are usually striking if they are in plenty of well chosen colours or monochrome. I prefer colourful pics, and so I will resume that you have a 16 colour display for this intro. If you have more colours then you can adapt a similar approach for even more colourful images. I personally have a two favourite palettes, red and cyan being the first, blue and cyan being the second. They are pretty easy to set and work well in ST low rez. Once in Fractgen go straight to the colour dialog box (by pressing the right mouse button and selecting "Colours") and try setting colour 0 to black (0, 0, 0), colour 14 to cyan (0, 1000, 1000) and colour 15 to a lighter cyan - perhaps (142, 1000, 1000). For a red and cyan palette set colour 7 to red(1000, 0, 0) and colour 8 to a dark cyan(0, 142, 142). Now select colour 14 and double-click on colour 8, then select colour 7 and double-click on colour 0. For a blue and cyan palette set colour 7 to blue(0, 0, 1000). Now select colour 7 and double-click on colour 0, then double click on colour 14. Now you should have a rather nice palette to play with. Select "OK" and wait to the appearing fractal to finish generating. Try zooming in on an area (press the left mouse button for the mouse pointer to appear - you can now drag a rubber band over an area to magnify). The most interesting parts are the areas close to the black region that you see in the centre of the screen. Don't try zooming in on that region as there is nothing to see. Try one of the two spikes just to the left of centre. The screen will now take a while to generate. If in the meantime you see an area that you think may be interesting too see closer up don't wait around to for the computer - select that area immediately! If you select a small area close to the central black region then some of that black can be eliminated. If you go to the second page of the Options dialog box and increase the "Max Iterations", from say 128 to 500 and redraw the picture you may see more detail, though the picture will take longer to draw. Generally, if you are going to zoom far into a picture it is best to increase this value from 128 in order to obtain more detail. Try saving a picture and importing it into Degas Elite or Neochrome and using the colour cycling option for some really interesting effects. Now we get to play around with some options. Go to the page 1 of the options screen and enter these coordinates; x = -1.2176 to -1.0871 y = 0.1869 to 0.3437 and let the screen draw. This will take about 5 mins 20 secs on a standard ST in low rez. Now go to page 2 of the options screen. Set "Min iterations" as 30 and let the screen redraw. Most of the screen should now be drawn in black. What you have done is told the generator to ignore all values less than 30 - effectively masking them from the picture. Again in page 2, set the "Max iterations" parameter to 44 and again redraw. Now all values greater than 44 and less than 30 will be ignored. This leaves us 15 values that are used - the same number of colours that are used in your palette. If you have chosen a blue to cyan palette, then value 30 will be plotted in dark blue and 44 in light cyan. I have purposefully chosen the values to 30 and 44 to coincide with the palette. Now go back to page 2 and turn the "Maximum saturations" pop-up to ON. Again redraw. All colours greater than 44 will now be treated as if they were 44, that is drawn in light cyan. If you were to zoom in on this area you could get some pretty good effects of lightning with a cyan palette. Changing the palette to one which goes from black to red to yellow can lead to some pretty good effects of fire and pictures of the sun. OK, lets reset the options. Set "Max iterations" to 128, "Min iterations" to 0 and the saturations to "Off". Then set the "Colouring Method" to "Coloured Decomposition" and redraw. Spot the difference? Spiky bits should appear all over the place. Well that's enough - the fun is in the experimenting, but don't forget to take the occasional break for eating and sleeping! If you want some examples of what I think are good pictures, see below. Remember that fractals are infinite - there is always something new to discover and you may be the first person to see the screen that you have generated. ******************************** ** Jon's Guide to Wacky Fracs ** ******************************** Here are a few interesting pictures to show your friends, family and pets. Don't forget to set some psychedelic colours first. When trying these images, set the fractal type first then enter the rest of the data in the Options dialog box. Be warned that some of these fractals may take a while to draw. The approximate times where given are for generating the picture in ST low rez on a standard ST and all are under 20ish minutes. The longest picture I have generated to date took over 12 hours! The Plunge ---------- Fractal: Mandelbrot classic X = -0.69106 to -0.690906 Y = 0.387103 to 0.387228 Time taken = 13 mins Spike ----- Fractal: Mandelbrot Classic X = 0.331046 to 0.36092 Y = -0.07227 to -0.047726 Colouring method: Coloured Decompostition Time taken = 12 mins Thingy ------ Fractal: Julia Set Parameters = -0.12375, 0.56508i X = -2 to 2 Y = -1.5 to 1.5 Colouring method: Coloured Decomposition Infinite region colouring method: Attractor Attractor disk radius: 0.01 Time taken = 20 mins